from abc import ABC, abstractmethod
from typing import List, Tuple, Dict
# from src.core.models import Order, Trade # Old dataclass import
from core.models import Order, Trade # Import ORM Trade model and Order dataclass

class StorageInterface(ABC):
    """存储接口"""
    
    @abstractmethod
    def save_orders(self, orders: List[Order]) -> Dict:
        """保存订单并返回详细结果"""
        pass
    
    @abstractmethod
    def save_trades(self, trades: List[Trade]) -> None:
        """保存交易"""
        pass
    
    @abstractmethod
    def get_orders(self) -> List[Order]:
        """获取所有订单"""
        pass
    
    @abstractmethod
    def get_trades(self) -> List[Trade]:
        """获取所有交易"""
        pass
    
    @abstractmethod
    def is_order_duplicate(self, order: Order) -> bool:
        """检查订单是否重复"""
        pass
    
    @abstractmethod
    def is_trade_duplicate(self, trade: Trade) -> bool:
        """检查交易是否重复"""
        pass
    
    @abstractmethod
    def update_trade(self, trade_id: str, updates: dict) -> bool:
        """更新单个交易记录"""
        pass
    
    @abstractmethod
    def delete_trade(self, trade_id: str) -> bool:
        """删除单个交易记录"""
        pass 

    @abstractmethod
    def get_table_columns(self, table_name: str) -> list:
        """获取指定表的所有列名"""
        pass

    @abstractmethod
    def get_table_row_count(self, table_name: str) -> int:
        """获取指定表的行数"""
        pass 

    @abstractmethod
    def get_all_table_names(self) -> list:
        """获取所有表名"""
        pass 